import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

/**
 * expertService.js - 工作台卡片 service
 * @date: 2019-02-23
 */
import request from 'utils/request';
import { CPAAS_IAM } from 'utils/config';
/**
 *
 * 查询固定的常用功能
 * @export
 * @returns
 */

export function queryFunctions() {
  return _queryFunctions.apply(this, arguments);
}
/**
 * 保存 - 常用功能
 * @export
 * @param {Object} params
 * @returns
 */

function _queryFunctions() {
  _queryFunctions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            return _context.abrupt("return", request("".concat(CPAAS_IAM, "/v1/user-dbd-menu"), {
              method: 'GET'
            }));

          case 1:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _queryFunctions.apply(this, arguments);
}

export function addFunctions(_x) {
  return _addFunctions.apply(this, arguments);
}

function _addFunctions() {
  _addFunctions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(params) {
    return _regeneratorRuntime.wrap(function _callee2$(_context2) {
      while (1) {
        switch (_context2.prev = _context2.next) {
          case 0:
            return _context2.abrupt("return", request("".concat(CPAAS_IAM, "/v1/user-dbd-menu"), {
              method: 'POST',
              body: params
            }));

          case 1:
          case "end":
            return _context2.stop();
        }
      }
    }, _callee2);
  }));
  return _addFunctions.apply(this, arguments);
}